import React from "react";
import { LoadingOutlined } from "@ant-design/icons";
import { Spin } from "antd";

import styles from "./index.module.scss";

const antIcon = <LoadingOutlined style={{ fontSize: 24 }} spin />;

const Loading: React.FC<{ text?: string }> = (props) => (
  <>
    <div className={styles.loading}>
      <Spin indicator={antIcon} />
      <span>
        {props && (props as any).text
          ? `${"" + (props as any).text}`
          : `加载中，请稍候……`}
      </span>
    </div>
  </>
);

export default Loading;
